/**
 * 物流界面
 */
class logisticsInfo extends eui.Component{
    private return:eui.Button;
    private pro:eui.Rect;
    private msg:eui.Label;
    private date:eui.Label;
    private info:eui.Label;
    private nickName:eui.Label;
    private phoneNum:eui.Label;
    private address:eui.Label;
    private status:eui.Label;

    private scroll:eui.Scroller;
    private logisticsList:eui.List;

    private _arrayData:eui.ArrayCollection;
    private _logisticsData:Array<any> = [];

    private _obj:any;
    public constructor(){
        super();
        this.addEventListener(eui.UIEvent.COMPLETE , this.createCompleteEvent,this);
        this.skinName = "logisticsInfoSkin"; 
    }

    private createCompleteEvent():void{
        this.removeEventListener(eui.UIEvent.COMPLETE , this.createCompleteEvent, this);
        this.inIt();
    }

    private inIt(){
        this.return.addEventListener(egret.TouchEvent.TOUCH_TAP,()=>{
            this.dispatchEventWith("return");
        },this);

        Dispatcher.ins.addEventListener("logisticsInfo",this.setInfo,this);
    }
    public getInfo(obj):void{
        this.msg.text = obj.msg;
        this.date.text = obj.OrderDate;
        this.info.text = "";
        this.nickName.text = obj.Username;
        this.phoneNum.text = obj.PhoneNum;
        this.address.text = obj.Address;
        this.status.text = obj.status;
        let dataPost = {
            "com":obj.ThirdName,
            "num":parseInt(obj.ThirdId)
        }
        http.getHttpServer("logisticsInfo",dataPost);
    }
    private setInfo(evt:GameEvent):void{
        let obj = evt.data;
        let arr = obj.data;
        this._arrayData = new eui.ArrayCollection(arr);
        this.logisticsList.dataProvider = this._arrayData;
        this._arrayData.refresh();
        let note = "";
        switch (parseInt(obj.state)){
            case 0:{
                note = "在途中";
                break;
            }
            case 1:{
                note = "已揽收";
                break;
            }
            case 2:{
                note = "疑难";
                break;
            }
            case 3:{
                note = "已签收";
                break;
            }
            case 4:{
                note = "退签";
                break;
            }
            case 5:{
                note = "同城派送中";
                break;
            }
            case 6:{
                note = "退回";
                break;
            }
            default:{
                note = "暂无信息";
                break;
            }
        }
        this.info.text = note;
    }
}
